/**   
* @Title: GuaServiceImpl.java 
* @Package com.kerrykidz.membership.service 
* @Description: 
* Copyright: Copyright (c) 2014 
* Company:wuwh team by iss
* @author: Tik   
* @date: 2014年8月15日 下午1:52:15 
* @version: V1.0
*
*/
package com.kerrykidz.membership.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kerrykidz.membership.dao.mapper.CusFngEntityMapper;
import com.kerrykidz.membership.dao.mapper.CusGuaEntityMapper;
import com.kerrykidz.membership.dao.mapper.CusMemEntityMapper;
import com.kerrykidz.membership.dao.model.CusFngEntity;
import com.kerrykidz.membership.dao.model.CusGuaEntity;
import com.kerrykidz.membership.dao.model.CusMemEntity;
import com.kerrykidz.membership.service.IGuaService;
import com.rdp.framework.exception.RDPException;

/** 
 * @ClassName: GuaServiceImpl 
 * @description: 大致描述该类的用途，内容简短易懂 
 * @author: Tik 
 * @date: 2014年8月15日 下午1:52:15 
 * @version: V1.0
 *
 */
@Service
public class GuaServiceImpl implements IGuaService {

	@Autowired
	private CusGuaEntityMapper guaMapper;
	@Autowired
	private CusFngEntityMapper fngMapper;
	@Autowired
	private CusMemEntityMapper memMapper;

	/**
	 * 查询监护人
	 * @param guaId
	 * @throws RDPException
	 * @date: 2014年8月15日
	 */
	@Override
	public CusGuaEntity findGuaById(String guaId) throws RDPException {
		return guaMapper.findEntityById(guaId);
	}

	/**
	 * 删除监护人
	 * @param guaId
	 * @throws RDPException
	 * @date: 2014年8月15日
	 */
	@Override
	public void deleteGua(CusGuaEntity gua) throws RDPException {
		
		// 更新会员变更人、时间
		CusMemEntity member = new CusMemEntity();
		member.setPkMemId(gua.getMemberId());
		member.setModiBy(gua.getModiBy());
		memMapper.updateEntity(member);
		
		guaMapper.deleteEntity(gua);
		CusFngEntity fng = new CusFngEntity();
		fng.setFkMemId(gua.getPkGuaId());
		fngMapper.deleteEntity(fng);
	}

}
